/* *  
 * Copyright (C) 2004-2008 Mocha Almond Fudge AI, SIT KMUTT
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package jboard.model;

/**
 * Represent the x, y coordinates
 * 
 * @author Vashira Ravipanich
 */
public class Token {
    private int x;
    private int y;
    
    public Token() {
        this.x = -1;
        this.y = -1;
    }
    
    public Token(int x, int y) {
        this.x = x;
        this.y = y;
    }
    
    public boolean equals(Object o) {
        Token token = (Token) o;
        if(this.getX() == token.getX() && this.getY() == token.getY())
            return true;
        return false;
    }
      
    public int getX() {
        return x;
    }
    
    public int getY() {
        return y;
    }
    
    public void setX(int x) {
        this.x = x;
    }
    
    public void setY(int y) {
        this.y = y;
    }
    
    public String toString() {
    	String tern = "";
    	switch (getX()){
    	case 0: tern = "A";break;
    	case 1: tern = "B";break;
    	case 2: tern = "C";break;
    	case 3: tern = "D";break;
    	case 4: tern = "E";break;
    	case 5: tern = "F";break;
    	case 6: tern = "G";break;
    	case 7: tern = "H";break;
    	}
    	
    	switch (getY()){
    	case 0: tern += "1";break;
    	case 1: tern += "2";break;
    	case 2: tern += "3";break;
    	case 3: tern += "4";break;
    	case 4: tern += "5";break;
    	case 5: tern += "6";break;
    	case 6: tern += "7";break;
    	case 7: tern += "8";break;
    	}
        
    	return tern;
    }
}
